package dominion.player;

import dominion.Dominion;
import dominion.kingdom.Market;
import dominion.kingdom.Smithy;

public class SmithyMarketPlayer extends TresureOnlyPlayer {

	boolean smithy = false;
	boolean market = false;

	public SmithyMarketPlayer(Dominion dominion) {
		this("SmithyMarket", dominion);
	}

	public SmithyMarketPlayer(String name, Dominion dominion) {
		super(name, dominion);
	}

	@Override
	public int buy(Dominion dominion, int value) {
		if (smithy == false && 3 < value && dominion.buy(this, new Smithy())) {
			smithy = true;
		} else if (market == false && 8 < turn() && value == 5
				&& dominion.buy(this, new Market())) {
			market = true;
		} else {
			super.buy(dominion, value);
		}
		return 0;
	}

}
